<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    
</head>
<body>
    <button id="b" onclick="fn2()" ondblclick="fn1()">点击</button>
</body>
<script>
    // var btn1 = document.getElementById('b')
    // btn1.addEventListener('click',fn);
    // btn1.addEventListener('dblclick',fn1);
    var tt;
    function fn2() {
        tt = false;
        window.setTimeout(fn,500)
        function fn() {
            if (tt == false) {
                alert('2班');
            }
        
        // btn.removeEventListener('click',fn);
    }
    }
    
    function fn1() {
        tt = true;
        alert('4班');
    }
</script>
</html>